package main

import (
	"fmt"
	js "github.com/dop251/goja"
)

func runJsCode(jsCode string) (string, error) {
	vm := js.New()                 // 创建engine实例
	r, err := vm.RunString(jsCode) // 执行javascript代码
	if err != nil {
		return "", err
	}
	return fmt.Sprint(r.Export()), nil
}
